import requests
import time
import execjs

t = str(int(time.time()*1000))
url = 'https://www.jdl.cn/ecology/getSession?_={}'.format(t)
headers = {
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
}
res = requests.get(url,headers=headers)
print(res.text)
session = res.json()['obj']
print(session)
ct = execjs.compile(open(r"E:/nodeProject/js/jd_yzm.js",encoding='UTF-8').read()).call('data',session)
print(ct)

# getData
# result = execjs.compile(open(r"E:/nodeProject/js/jd_yzm.js",encoding='UTF-8').read()).call('getData',session,ct)
# print(result)
session = 'mPOJXBVF-0Ehw9ZUigaAfWh0ite09hOuLCKaxsbn5QtukAGv6MZZX4hDS3aCo7HD15oEaT9BvhtVCTvxSr9kxPHU3XWD4v3yg1NJYL5QXFf2dAHvC2czW_6Bz2wtzPr7bedg-356oyzNXgqSWAYs2aZomgdzrT-lXQiwXQUkk0_oxVVDFd02wbXi2QGXe_QA2qM9spY739VHQbdvnEZSgjyPUvyZ8Kd_fkIZo9Yki3AXl8I_'
ct = 'KS3ZHAhiiMezt2z-D0NqytmSOtilfOduc9HbMFlenlNknfXg6Teji8d6BQYeBj461ohHu7q_Ta9Y-9-dJxNATNa-D4JH0ggXS3sfhwIuOZGFboNTfyemA2BC5d7UqNxckFpJd_bSyd1smNdb8Awkws2hW7zeKNeLPFC_BIumJHe0TGSqG3daknwZH8dcgwpwISpQgMSi4PCYmSk2ntp48BAbB7fUHTF8fpUPKcbH1jgG4h80EDqa3LmFF0JedryqnztPgotNAnxSyVBDDiyCkAalwgk_dFKZBnQcukaZPvqAfGDmqXz8wUcZzc17H1wWdV2_uAus92yptHMY49svX04Y_xGNYjxRCCLj6Jf2fMfjzqcRfqVhgbpdoOt4wOm2jXTCXw8P2Jvuvh8IXZNo9gpRd2QSOuo8-mrelGxCPXgDQfr__1LkXMEBjORvsFU-D4uyFt1bBb6W1RtM--XkrfoSeWrxqhcYRkSac9RuMOYeo26mepHpH0toPotgDaSrKkJzGEC36gbDtfu9YtBcgIKfw1-2MOLG9XJ4fZQaSfRA90HnaJPsphtMHG7o5tskqtyfzjOHE3y-GlIb1Qn0yc7tHEAjIhZg4d6PWtoNIJxWtPmA70uP28jSkuF4V3VVdZd82_9vzYcIuirfJabvTfJOK0aAL4rrlehptk2W01Q_e6TO-Yee2c7G0pLxYcUNQNKC_pHAMN9Mor08n8qVJnnPtg0tYgFKAxfzU8jwoj_M9LLQisDUJnl1tF1NeR0ovLxM9xA40QHk4PvUlXGqMrie_O_7TSWLAjGGBN93tgTL-0KhsJgODnMQPbY8MBzq0RZTKfNLpNaj5zBooRIRKnGcmQPiaw4byeiuB7aaUS8xAfwXCOPTXm1cLbXImnKPQ4CGClLghrI3RJlXu85Inoeb7bH7QhHfZ_LEXO1UHKeLbofHPIbeGGLHmQSbVnQRSEbqnDDme81Q4xgCvCUGpo4b7mSnx69sETDRUfnMVtIfUdJw8LDtNMSL4-Q1yc_0lRCZVOVIHl0zBN6CAC04C6eNQN6CPhJZ5JR0rNIRiO_cxYCiAo2Z5HGxMHOop180US4-gJaKS8FOIpP_7tnWPgc999am7q1ULd7wzchEH6M-3wd2DX0sjd7OYydiFJDTNahamshSDU_9nnTPaSFxcvU8RHWracq7ZhGaPNzepcKr4bkIZSKBe0JgiienzubX2fM1-p3CglNBXGiA'
url = 'https://jcap.m.jd.com/cgi-bin/api/fp?si=%s&ct=%s&version=2&lang=1&client='%(session,ct)
# data = {
#     "si":session,
#     "ct":ct,
#     "version":"2",
#     "lang":"1",
#     "client":""
# }
headers = {
    'authority': 'jcap.m.jd.com',
    'method': 'POST',
    'path': '/cgi-bin/api/fp',
    'scheme': 'https',
    'accept': 'application/json, text/plain, */*',
    'accept-encoding': 'gzip, deflate, br',
    'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
    'cache-control': 'no-cache',
    'content-type': 'application/x-www-form-urlencoded;charset=UTF-8',
    # 'cookie': 'TrackID=1AOoQV0hRXqpw5UZuT1yHAN_zjlg-V9phLoHX6q-_1cd_cf0DPt7sFe8rqCMjaBXUQuIMJAua7OZKP_VTdUDhLNpxXSsGhhWW4QzXGwndQ1I; thor=317DF86A79D04E8215965CA2889DDF81D80BD84BD52113E163E563DD583F746711B8BB41C1E7EF5B61287801D0182A40249ECA97536FF660850EB67EF464936F094983DA656BAF6B1D533760C5AD13F0991892E5CCEFDEBDABF7FA497B52CE744CE7E48915581224CF17BC48C2E19C7AAAF3FEA96359716CBA30221C284F360F; pinId=HmFWFGJN4LdIdSh6p8esqQ; pin=%E5%90%9B%E4%B8%B0%E4%BB%93%E5%BA%93; unick=%E5%90%9B%E4%B8%B0%E4%BB%93%E5%BA%93; ceshi3.com=000; _tp=e10oAB9dBLaSDC0YXNjnjTY0Zu1YFrVkJ0SsFh9xVKP2l8IjeMBOZGQ4B9ljV6kr; logining=1; _pst=%E5%90%9B%E4%B8%B0%E4%BB%93%E5%BA%93',
    'origin': 'https://www.jdl.cn',
    'pragma': 'no-cache',
    'referer': 'https://www.jdl.cn/',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'cross-site',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36',
}
res = requests.get(url,headers=headers)
print(res.text)